package com.zhang.use;

import com.zhang.step.Step1;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class Test1 {

    //动态打印信息
    @Test
    public void test1() {
        Logger logger = LoggerFactory.getLogger(Test1.class);
        String name="zf";
        int age=26;

        logger.info("学生信息-姓名:{} 年龄:{}",name,age);
    }

    //日志对异常信息的处理
    @Test
    public void test2() {
        Logger logger = LoggerFactory.getLogger(Test1.class);

        try {
            int a = 10/0;
        } catch (Exception e) {
            logger.info("xx类中的xx方法出现了错误,请及时关注");
            logger.info("具体错误是:",e);
        }

    }
}
